package eu.jpereira.trainings.designpatterns.structural.decorator.channel.decorator;

import java.util.ArrayList;
import java.util.List;

import eu.jpereira.trainings.designpatterns.structural.decorator.channel.SocialChannel;

public class WordCensor extends SocialChannelDecorator
{
	List<String> blackList;
	
	public WordCensor()
	{
		blackList = new ArrayList<String>();
		blackList.add("Microsoft");
	}
	public WordCensor(SocialChannel decoratedChannel)
	{
		this();
		this.delegate = decoratedChannel;
		
	}
	@Override
	public void deliverMessage(String message)
	{
		for(String blackListItem : blackList) message = message.replace(blackListItem, "###");
		delegate.deliverMessage(message);
	}

}
